﻿using Kogel.Dapper.Extension;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace IdentityService.Domain
{
    public interface IIdRepository
    {
        Task<User?> FindByIdAsync(long userId);//根据Id获取用户
        Task<User?> FindByNameAsync(string userName);//根据用户名获取用户
        Task<User?> FindByPhoneNumberAsync(string phoneNum);//根据手机号获取用户
        Task<User?> FindBySinaOAuthAsync(string SinaId);//根据根据微博ID获取用户
        Task<bool> CreateAsync(User user);//创建用户
        Task<bool> CheckForSignInAsync(User user, string password ,bool lockoutOnFailure);

        //Task<bool> RoleExistsAsync(string roleName);//是否存在角色
       // Task<bool> RoleExistsAsync(string roleName);//是否存在角色
        // Task<bool> AccessFailedAsync(User user);//记录一次登陆失败

        /// <summary>
        /// 获取用户的角色
        /// </summary>
        /// <param name="user"></param>
        /// <returns></returns>
        Task<IList<string>> GetRolesAsync(User user);
        (bool, int) CheckForSignIn(User user, string password, bool lockoutOnFailure);

        Task<(bool, User?, string? msg)> AddTeacherAsync(User user); //添加教师账号

        Task<(bool, User?, string? msg)> AddUserAsync(User user,string RoleName); //添加教师账号
        IEnumerable<User> FindAllUsers(long userId);

        public PageList<User> FindAllUserPage(long userId, int pageIndex, int pageSize);//分页查询
    }
}
